package com.feri.sg.pojo.vo;

import com.feri.sg.constant.StatusCode;
import lombok.Data;

/****
 * @Description:返回实体Bean
 * @Date  15:55
 *****/
@Data
public class R<T> {

    private Integer code;//返回码
    private String message;//返回消息
    private T data;//返回数据

    public R( Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = (T) data;
    }

    public R( Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public R() {
        this.code = StatusCode.OK;
        this.message = "操作成功!";
    }
    public static R ok(Object data){
        return new R(0,"操作成功",data);
    }
    public static R ok(){
        return ok(null);
    }
    public static R fail(Object data){
        return new R(1,"操作失败",data);
    }
}
